Consolidation of copy-back and write in pram blocks

ABSTRACT

A method for performing a write operation in a random access memory (RAM) includes selecting a target block in a RAM with a greatest number of invalid pages, reading valid pages from target block, when a number of invalid pages is greater than a predetermined threshold, performing a bitline-wise block erase of the target block in said RAM, and copying-back valid data to the erased target block in a row-by-row set operation, wherein the erased target block is written with the valid data. Performing the bitline-wise block erase includes sequentially powering on each bitline with a predetermined reset voltage where all other bitlines and wordlines are grounded.

TECHNICAL FIELD

Embodiments of the present disclosure are directed to methods for improving the efficiency of write operations in phase change random access memory (PRAM).

DISCUSSION OF THE RELATED ART

Phase-Change RAM (PRAM) is currently a leading next-memory approach. However, although single cell write and read power are low cost and competitive, packing multiple cells in dense cross-point array architectures cause memory operations to consume high power due to effects on unselected cells. The resulting energy magnitude offsets cell advantages. Therefore, array-scale process design and data management algorithms are needed to cope with redundant power issues.

To switch a cell from high to low-resistance state, a high voltage drop is required. The corresponding wordline and bitline are assigned with the required potentials, but the unselected cells that are placed on the same row or column also suffer from voltage variations. Attempts to reduce the resulting unwanted potentials by using additional voltage on unselected bitlines pass the problem to unselected cells on those columns and to assignment of voltage in other wordlines. Eventually, a set of four voltages, for the selected and unselected rows and columns, is used to mitigate unwanted power and write disturb. The equivalent process is performed when transforming cells from low to high-resistance state, with reverse voltage drops, possibly in other values.

Write operations are the main source of power consumption in emerging phase change memory (PCM) technologies, such as phase change RAM (PRAM). In a cross-point vertical array architecture, a set of voltages or high impedances is applied to all wordlines and bitlines such that the intended write voltage is the potential difference over target cells, causing their resistance to be switched. However, unselected cells also have unintended voltage drops. Since the resistance gap between low and high cell states is at least about an order of magnitude, almost all unwanted power, and consequentially most of total write power, is consumed by low-resistance cells, located in unselected wordlines.

SUMMARY

Exemplary embodiments of the present disclosure are directed to systems and methods for improving PRAM write algorithms by combining a write algorithm with selective valid pages read and copy-back. Analysis shows that up to a 40% power reduction can be obtained as compared to prior art algorithms. Embodiments of the disclosure can be implemented by modifying the software of an SSD controller. A method according to an embodiment of the disclosure is scalable as PRAM blocks occupy more wordlines.

According to an embodiment of the disclosure, there is provided a method for performing a write operation in a random access memory (RAM), including selecting a target block in a RAM with a greatest number of invalid pages, reading valid pages from target block, when a number of invalid pages is greater than a predetermined threshold, performing a bitline-wise block erase of the target block in said RAM, and copying-back valid data to the erased target block in a row-by-row set operation, wherein the erased target block is written with the valid data.

According to a further embodiment of the disclosure, the method includes receiving an incoming write request, and writing data of the incoming write request to the target block in the row-by-row set operation, wherein the incoming data is written to the erased block along with the valid data.

According to a further embodiment of the disclosure, the method includes placing data of the incoming write request in a write buffer of a controller of said RAM.

According to a further embodiment of the disclosure, performing the bitline-wise block erase comprises sequentially powering on each bitline with a predetermined reset voltage wherein all other bitlines and wordlines are grounded.

According to a further embodiment of the disclosure, the method includes, when the number of invalid pages is less than or equal to the predetermined threshold, performing a sub-block write operation of data received with a write request.

According to a further embodiment of the disclosure, the RAM is one selected from a group comprising a phase change random-access memory, a resistive random-access memory, a ferroelectric random-access memory, and a magnetoresistive random-access memory.

According to a further embodiment of the disclosure, the bitline-wise block erase is one of a partial block erase or a full block erase.

According to a further embodiment of the disclosure, the steps of selecting a target block, reading valid pages from target block, performing a bitline-wise block erase of the target block, and copying-back valid data to the erased target block are performed as one of an automatic refresh operation or as an operation initiated by a user.

According to a further embodiment of the disclosure, the method includes mapping a logical address of a bitline of the target block to a virtual address according to f({right arrow over (x)})={right arrow over (x)}·P·{right arrow over (b)}+r+c·q (mod 2^(n)+z), wherein {right arrow over (x)} is an n-bit logical address, f({right arrow over (x)}) is the virtual address, n is a log (base 2) of the logical address space size, P is an invertible n×n permutation matrix, {right arrow over (b)}=(2^(n-1),2^(n-2), . . . , 1)^(T) is a vector that converts the binary n-bit address to a natural number, z is a current number of spare lines,

$c = \left\{ {\begin{matrix} 1 & {{{if}\mspace{14mu} {\overset{\rightarrow}{x} \cdot P \cdot \overset{\rightarrow}{b}}} \geq {n - s}} \\ {0,} & {otherwise} \end{matrix},} \right.$

r is a round number, wherein a round is an act of remapping all lines in the target block, and s is a step number, wherein a step is an act of re-mapping one bitline.

According to a further embodiment of the disclosure, the method includes mapping the virtual address of the bitline of the target block to a physical address by mapping the virtual address v to v+i where i is the index of a maximum value s such that s_(i)<v, wherein s_(i)∈S=(s₁, . . . , s_(l)) wherein a value of s_(i) is a largest virtual address that maps to a physical address below b_(i) wherein b_(i)∈(b₁, . . . , b_(l)), a sorted list of physical addresses of bad lines wherein l is a current number of bad lines.

According to another embodiment of the disclosure, there is provided a non-transitory program storage device readable by a computer, tangibly embodying a program of instructions executed by the computer to perform the method steps for a write operation in a random access memory (RAM).

According to another embodiment of the disclosure, there is provided a method of performing a write operation in a random access memory (RAM), including selecting a target block in a RAM with a greatest number of invalid pages, and performing a sub-block write operation of data received with a write request, when the number of invalid pages is less than or equal to the predetermined threshold.

BRIEF DESCRIPTION OF THE DRAWINGS

FIGS. 1A-1B illustrate a voltage configuration of a single wordline write operation in a cross-point PRAM, according to an embodiment of the disclosure.

FIGS. 2A-2C illustrate a consolidation of copy-back and write operations, according to an embodiment of the disclosure.

FIG. 3 is a table that summarizes results of various power dissipation models, according to embodiments of the disclosure.

FIG. 4 is a table that illustrates the determination of a consolidation threshold, according to embodiments of the disclosure.

FIG. 5 is a graph of power consumption results as a function of the number of invalid pages in a PRAM block for various write algorithms, according to embodiments of the disclosure.

FIG. 6 is a table that presents device and array parameters that are considered in the power estimation, according to embodiments of the disclosure.

FIG. 7 illustrates that a logical-to virtual (L2V) address mapping includes a fixed component and a changing component, according to an embodiment of the disclosure.

FIG. 8 illustrates how wear-leveling uses the last line from the sequence as the target for the newly transferred line, so that within each round the lines are updated in a descending order, according to an embodiment of the disclosure.

FIG. 9 is a table that illustrates an example of a V2P mapping, where virtual addresses that are X's denote bad lines, according to an embodiment of the disclosure.

FIG. 10 is a block diagram of a system that implements a method for combining a write algorithm with selective valid pages read and copy-back, according to an embodiment of the disclosure.

DETAILED DESCRIPTION OF EXEMPLARY EMBODIMENTS

Exemplary embodiments of the disclosure as described herein generally provide systems and methods for improving PRAM write algorithms by combining a write algorithm with selective valid pages read and copy-back. While embodiments are susceptible to various modifications and alternative forms, specific embodiments thereof are shown by way of example in the drawings and will herein be described in detail. It should be understood, however, that there is no intent to limit the disclosure to the particular forms disclosed, but on the contrary, the disclosure is to cover all modifications, equivalents, and alternatives falling within the spirit and scope of the disclosure.

Past research has indicated that write power can be reduced by writing pages in block resolution rather than wordline. This scheme, referred as sub-block write aggregation, was to buffer a group of write requests, select the block with the most invalid wordlines, and then perform all phase RESETs, which modify cells to high-resistance, in a row-by-row manner, followed by a SET to group cells separately. In this algorithm, the unintended voltage drops are located mostly on high-resistance cells. Analysis of the results showed there was an up to 85% energy reduction as compared to random wordline writes. The scheme was expanded to include multi-level cell (MLC) writes and to manage opportunistic power-saving writes.

Embodiments of the disclosure are directed to methods of improving PRAM write algorithms to save additional energy, by combining a write algorithm with selective valid pages read and copy-back. It has been observed that performing a bitline-wise RESET to a whole block, by setting all bitlines with the RESET voltage while all wordlines are grounded at zero volts, is highly power-efficient. Therefore, embodiments of the disclosure are directed to a case of copying valid pages, execute bitline-wise block erase, and writing back the valid data along with new incoming write requests. When the number of invalid wordlines is low, the previous sub-block write scheme is expected to be more power-efficient, whereas when most of the wordlines are invalid, it is preferable to read valid pages, perform bitline-wise erases and copy-back the data along with the new data write. A consolidation scheme according to an embodiment calculates the number of invalid pages in which such a process has advantage over sub-block write aggregation. Power dissipation can be modeled in both processes to find the number of invalid pages in which copy-back outperforms sub-block, and this selection can be integrated with online write algorithm.

Notations and Definitions

Notation 1 (Cross-Point Array Size): The number of (rows)×(columns) in a memory cells matrix is denoted with MXN, where the cross-point array wordlines (rows) and bitlines (columns) are denoted with M and N. In addition, WIJBL are the abbreviations for wordline/bitline, respectively. Notation 2 (Data Distribution and Cell's States): Data according to embodiments is assumed to be distributed binary with Bernoulli-(½) probability. The device is considered as binary (single set level cell—SLC) with low-resistance state (LRS) marked with Rr_(L) and high-resistance (HRS) with R_(H). An MLC generalization is given below. Notation and Definition 3 (Random Wordline Write): A write process according to an embodiment includes two steps: SET and RESET (or vice versa). In a RESET phase, cells are switched to HRS (RESET) by applying a reset voltage V_(RST) on the wordline and grounding (0 volt) target cell bitlines. The unselected rows/columns are powered with V_(RWI)/V_(RBL). If a prior read is carried and only the LRS cells among the involved cells are selected, power consumption is reduced. In a SET phase, cells are switched to LRS (SET). The voltage V_(SET) is used for target wordline, intended cells bitlines are grounded and V_(SWI)/V_(SBL) are used for unselected worldines/bitlines. Notation and Definition 4 (Sub-Block Write): An algorithm according to an embodiment buffers several write requests, selects the block with the most invalid pages, performs RESET to all invalid pages according to new data, using a prior read to avoid power waste, followed by a proper row-by-row SET. Notation and Definition 5 (Bitline-Wise Block Erase and SET): A first erase phase according to an embodiment sets V_(RST) in each bitline, while other bitlines are grounded, and grounds all wordlines. Next, the block is written with wordline SET operations, i.e., V_(SET) on target wordline, selected cells bitlines are grounded and unselected rows/columns are powered with V_(SWI)/V_(SHL). Notation and Definition 6 (RESET/SET and Read Power): According to embodiments, the power to switch a cells from a low to high, or a high to low, resistance state is denoted P_(RST) or P_(SET), respectively. The consumed power during wordline read is denoted P_(RD). Notation and Definition 7 (Write Power of a Single Memory Cell): According to embodiments, the power needed to change a single cell's resistance state from low to high (reset) is denoted and defined as:

P _(RST)=∫_(R) _(L) ^(R) ^(H) I(R)V _(RST) dR,

where I(R) is the current through the PRAM device at resistance R. The alternative cell's high to low write (set) power is:

P _(SET)=∫_(R) _(H) ^(R) ^(L) I(R)V _(SET) dR.

The latencies of set and reset are assumed to be relatively the same: t_(SET)=t_(RST), and therefore the energy is proportional to power. In case that the set time differs from the reset time, the analysis still holds and derivation of energy data would require multiplying the power with the corresponding time duration. Notation and Definition 8 (Read Operation and Power): According to embodiments, a read is performed by powering the target wordline with V_(RD) when all bitlines are grounded (0v). The current at each bitline is measured for the cell's resistance estimation. The power of the read process (with random data distribution) is:

$P_{RD} = {\frac{N}{2}{{V_{RD}^{2}\left( {\frac{1}{R_{L}} + \frac{1}{R_{H}}} \right)}.}}$

The read power includes a parasitic component that originates from sneak current. This fraction may be considered to be negligible when compared to the overall power and may be omitted in a gain analysis.

FIGS. 1A-1B illustrate a voltage configuration of a single wordline write operation in a cross-point PRAM, according to an embodiment of the disclosure. In a SET operation, illustrated in FIG. 1A, the middle wordline is written such that second, third and fifth cells (from left to right, marked with black circles) are switched to LRS with voltage drops V_(SET). The unselected wordlines and bitlines are powered with V_(SWL) and V_(SBL). In a RESET operation, illustrated in FIG. 1B, the first and fourth cells are at the middle wordline are switched to HRS by voltage drop of −V_(RST). The remaining unselected wordlines and bitlines are powered with V_(RWL) and V_(RHL). The order can be either SET-before-RESET or RESET-before-SET.

Power Comparison of Write Methods

According to an embodiment, an analytical model of power consumption is constructed for a consolidated copy-back and write method.

1) Random Wordline RESET&SET with Prior Read

In a planned read operation according to an embodiment, the location of HRS cells is known. Out of N/2 planned HRS, half are already in that state and reset is executed on N/4 cells. The unselected cells on target wordline are N/2 HRS and N/4 in LRS and are affected with V_(RBL). The remaining wordlines are N/4 cells affected by V_(RST)−V_(RWL) and 3N/4 cells affected by V_(RBL)−V_(RWL) with equally distributed LRS and HRS cells. The power of the reset phase with known wordlines is:

${{P_{{RD} - {RBS} - {RST}} = {{\frac{N}{4}P_{RST}} + {\frac{3N}{4}{V_{RBL}^{2}\left( {\frac{1}{3R_{L}} + \frac{2}{3R_{H}}} \right)}} +}}\quad}{\quad\quad}{\quad{\left( {M - 1} \right){\quad{\left\lbrack {{\frac{N}{4}\left( {V_{RST} - V_{RWL}} \right)^{2}\left( {\frac{1}{R_{L}} + \frac{1}{R_{H}}} \right)} + {\frac{3N}{4}\left( {V_{RBL} - V_{RWL}} \right)^{2}\left( {\frac{1}{R_{L}} + \frac{1}{R_{H}}} \right)}} \right\rbrack.}}}}$

Similarly, the LRS cells are known prior to the set phase and N/4 out of planned N/2 are already in LRS. The remaining wordline cells are at HRS due to previous reset phase.

$P_{{RD} - {RBS} - {SET}} = {{\frac{N}{4}P_{SET}} + {\frac{3N}{4}\left( {V_{SET} - V_{SBL}} \right)^{2}\left( {\frac{1}{3R_{L}} + \frac{2}{3R_{H}}} \right)} + {\left( {M - 1} \right){\quad{\left\lbrack {{\frac{N}{4}{V_{SWL}^{2}\left( {\frac{1}{2R_{L}} + \frac{1}{2R_{H}}} \right)}} + {\frac{3N}{4}\left( {V_{SWL} - V_{SBL}} \right)^{2}\left( {\frac{1}{2R_{L}} + \frac{1}{2R_{H}}} \right)}} \right\rbrack.}}}}$

The overall power in reset-before-set with prior read is:

$P_{{RD} - {RBS}} = {{P_{RD} + P_{{RD} - {RBS} - {RST}} + P_{{RD} - {RBS} - {SET}}} = {P_{RD} + {\frac{N}{4}P_{RST}} + {\frac{N}{4}P_{SET}} + {\frac{3N}{4}V_{RBL}^{2}\left( {\left( \frac{1}{3R_{L}} \right) + \left( \frac{2}{3R_{H}} \right)} \right)} + {\frac{3N}{4}\left( {V_{SET} - V_{SBL}} \right)^{2}\left( {\left( \frac{1}{3R_{L}} \right) + \left( \frac{2}{3R_{H}} \right)} \right)} + {\frac{N\left( {M - 1} \right)}{4}{\left( {\frac{1}{2R_{L}} + \frac{1}{2R_{H}}} \right)\left\lbrack {\left( {V_{RST} - V_{RWL}} \right)^{2} + {3\left( {V_{RBL} - V_{RWL}} \right)^{2}}} \right\rbrack}} + {\frac{N\left( {M - 1} \right)}{4}{\left( {\frac{1}{2R_{L}} - \frac{1}{2R_{H}}} \right)\left\lbrack {V_{SWL}^{2} + {3\left( {V_{SWL} - V_{SBL}} \right)^{2}}} \right\rbrack}}}}$

Note that RESET-before-SET and SET-before-RESET were found to have about the same power consumption for a random wordline. 2) Sub-Block RESET&SET Aggregation with Prior Read

Since it is not common that a whole block contains invalid pages, a write operation according to an embodiment can be performed in sub-block resolution. The selected block has i invalid wordlines, which are first all RESET sequentially (each row separately) and then SET (wordline-wise). In the RESET phase, the power of unselected cells is gradually decreasing. In the first RESET operation, all other rows (M−1 rows) have expectancy of half of the cells at LRS. Adding a prior read to a sub-block write flow reduces power only at the reset phase, since at the SET phase all cells at the target wordline are HRS, and the read does not reveal information. The read targets only the cells that need RESET, with their specific bitline and wordline configuration, instead of performing RESET on all row cells. The first row (W1) RESET is equivalent to a single wordline RESET-before-SET with prior read:

P _(W1) =P _(RD-RBS-RST)

At the second row RESET, there is a single row with ¾ HRS cells and (M−2) rows with random data:

$P_{W\; 2} = {{\frac{N}{4}P_{RST}} + {\frac{3N}{4}{V_{RBL}^{2}\left( {\frac{1}{3R_{L}} + \frac{2}{3R_{H}}} \right)}} + {\left( {\frac{1}{4R_{L}} + \frac{3}{4R_{H}}} \right)\left\lbrack {{\frac{N}{4}\left( {V_{RST} - V_{RWL}} \right)^{2}} + {\frac{3N}{4}\left( {V_{RBL} - V_{RWL}} \right)^{2}}} \right\rbrack} + {{\left( {M - 2} \right)\left\lbrack {{\frac{N}{4}\left( {V_{RST} - V_{RWL}} \right)^{2}\left( {\frac{1}{2R_{L}} + \frac{1}{2R_{H}}} \right)} + {\frac{3N}{4}\left( {V_{RBL} - V_{RWL}} \right)^{2}\left( {\frac{1}{2R_{L}} + \frac{1}{2R_{H}}} \right)}} \right\rbrack}.}}$

The power consumption when doing RESET to the third wordline is:

$P_{W\; 3} = {{\frac{N}{4}P_{RST}} + {\frac{3N}{4}V_{RBL}^{2}\left( {\frac{1}{3\; R_{L}} + \frac{2}{3\; R_{H}}} \right)} + {2{\left( {\frac{1}{4R_{L}} + \frac{3}{4R_{H}}} \right)\left\lbrack {{\frac{N}{4}\left( {V_{RST} - V_{RWL}} \right)^{2}} + {\frac{3N}{4}\left( {V_{RBL} - V_{RWL}} \right)^{2}}} \right\rbrack}} + {{\left( {M - 3} \right)\left\lbrack {{\frac{N}{4}\left( {V_{RST} - V_{RWL}} \right)^{2}\left( {\frac{1}{2R_{L}} + \frac{1}{2R_{H}}} \right)} + {\frac{3N}{4}\left( {V_{RBL} - V_{RWKL}} \right)^{2}\left( {\frac{1}{2R_{L}} + \frac{1}{2R_{H}}} \right)}} \right\rbrack}.}}$

At the last ith row RESET out of M rows, (i−1) rows are with ¾ cells HRS. The consumed power is:

$P_{Wi} = {{\frac{N}{4}P_{RST}} + {\frac{3N}{4}V_{RBL}^{2}\left( {\frac{1}{3\; R_{L}} + \frac{2}{3\; R_{H}}} \right)} + {\left( {i - 1} \right){\left( {\frac{1}{4R_{L}} + \frac{3}{4R_{H}}} \right)\left\lbrack {{\frac{N}{4}\left( {V_{RST} - V_{RWL}} \right)^{2}} + {\frac{3N}{4}\left( {V_{RBL} - V_{RWL}} \right)^{2}}} \right\rbrack}} + {{\left( {M - i} \right)\left\lbrack {{\frac{N}{4}\left( {V_{RST} - V_{RWL}} \right)^{2}\left( {\frac{1}{2R_{L}} + \frac{1}{2R_{H}}} \right)} + {\frac{3N}{4}\left( {V_{RBL} - V_{RWL}} \right)^{2}\left( {\frac{1}{2R_{L}} + \frac{1}{2R_{H}}} \right)}} \right\rbrack}.}}$

The sum of RESET power of i rows out of M, given prior read data is:

$P_{{RD} - {SUB} - {RST}} = {{\sum_{J = 1}^{I}P_{wj}} = {{{i\left\lbrack {{\frac{N}{4}P_{RST}} + {\frac{3N}{4}{V_{RBL}^{2}\left( {\frac{1}{3\; R_{L}} + \frac{2}{3\; R_{H}}} \right)}}} \right\rbrack} + {\sum_{j = 0}^{i - 1}{\left( {\frac{1}{4R_{L}} + \frac{3}{4R_{H}}} \right)\left\lbrack {{\frac{N}{4}\left( {V_{RST} - V_{RWL}} \right)^{2}} + {\frac{3N}{4}\left( {V_{RBL} - V_{RWL}} \right)^{2}}} \right\rbrack}} + {\sum_{j = {M - i}}^{M - 1}\left\lbrack {{\frac{N}{4}\left( {V_{RST} - V_{RWL}} \right)^{2}\left( {\frac{1}{2R_{L}} + \frac{1}{2R_{H}}} \right)} + {\frac{3N}{4}\left( {V_{RBL} - V_{RWL}} \right)^{2}\left( {\frac{1}{2R_{L}} + \frac{1}{2R_{H}}} \right)}} \right\rbrack}} = {{i\left\lbrack {{\frac{N}{4}P_{RST}} + {\frac{3N}{4}{V_{RBL}^{2}\left( {\frac{1}{3\; R_{L}} + \frac{2}{3\; R_{H}}} \right)}}} \right\rbrack} + {\frac{i\left( {i - 1} \right)}{2}{\left( {\frac{1}{4R_{L}} + \frac{3}{4R_{H}}} \right)\left\lbrack {{\frac{N}{4}\left( {V_{RST} - V_{RWL}} \right)^{2}} + {\frac{3N}{4}\left( {V_{RBL} - V_{RWL}} \right)^{2}}} \right\rbrack}} + {{\frac{i\left( {{2\; M} - i - 1} \right)}{2}\left\lbrack {{\frac{N}{4}\left( {V_{RST} - V_{RWL}} \right)^{2}\left( {\frac{1}{2R_{L}} + \frac{1}{2R_{H}}} \right)} + {\frac{3N}{4}\left( {V_{RBL} - V_{RWL}} \right)^{2}\left( {\frac{1}{2R_{L}} + \frac{1}{2R_{H}}} \right)}} \right\rbrack}.}}}}$

In the SET phase, data read is not performed. The first wordline is written when all cells are in HRS in i rows and THE other (M−i) rows are with random data. In each wordline SET, the number of HRS rows decreases and random data rows increases by one. Therefore, it is equivalent to sub-block SET without prior read.

P _(RD-SUB-SET) =P _(SUB-SET).

The overall write power of sub-block with prior read in RESET phase is:

P _(RD-SUB-R&S) =i·P _(RD) +P _(RD-SUB-RST) +P _(RD-SUB-SET).

The result, normalized per single wordline, is:

$P_{{{{RD} - {SUB} - R}\&}S} = {P_{RD} + {\frac{N}{4}P_{RST}} + {\frac{3N}{4}{V_{RBL}^{2}\left( {\left( \frac{1}{3\; R_{L}} \right) + \left( \frac{2}{3\; R_{H}} \right)} \right)}} + {\frac{N}{4}\frac{\left( {i - 1} \right)}{2}{\left( {\frac{1}{4R_{L}} + \frac{3}{4R_{H}}} \right)\left\lbrack {\left( {V_{RST} - V_{RWL}} \right)^{2} + {3\left( {V_{RBL} - V_{RWL}} \right)^{2}}} \right\rbrack}} + {\frac{\left( {{2\; M} - i - 1} \right)}{2}\frac{N}{4}{\left( {\frac{1}{2R_{L}} + \frac{1}{2R_{H}}} \right)\left\lbrack {\left( {V_{RST} - V_{RWL}} \right)^{2} + {3\left( {V_{RBL} - V_{RWL}} \right)^{2}}} \right\rbrack}} + {\frac{N}{4}\left( {P_{SET} + \frac{V_{SET}^{2}}{R_{L}}} \right)} + {\frac{N}{2}\left( {V_{SET} - V_{SBL}} \right)^{2}\frac{1}{R_{H}}} + {\frac{N}{2}\frac{\left( {i - 1} \right)}{2}{\left( {\frac{1}{4R_{L}} + \frac{3}{4R_{H}}} \right)\left\lbrack {V_{SWL}^{2} + \left( {V_{SWL} - V_{SBL}} \right)^{2}} \right\rbrack}} + {\frac{\left( {{2\; M} - i - 1} \right)}{2}\frac{N}{4}{\left( {\frac{1}{2R_{L}} + \frac{1}{2R_{H}}} \right)\left\lbrack {V_{SWL}^{2} + \left( {V_{SWL} - V_{SBL}} \right)^{2}} \right\rbrack}}}$

3) Consolidated Copy-Back and Write

Given a block with i out of M invalid wordlines, a first step according to an embodiment is read out the valid pages:

P _(Prior-RD)=(M−i)P _(RD)

Next, an energy-efficient bitline-wise erase is performed column-by-column to all cells in the block:

$P_{{Block} - {ERS}} = {{\sum_{N}\left( {{\frac{M}{2}P_{RST}} + {\frac{M}{2}\frac{V_{RST}^{2}}{R_{H}}}} \right)} = {\frac{MN}{2}\left( {P_{RST} + \frac{V_{RST}^{2}}{R_{H}}} \right)}}$

According to an embodiment, after an erase, the read valid pages are grouped with additional new data for a total of M new write requests. The aggregated write is performed row-by-row. The power per wordline write grows since as more pages are written, more cells at LRS have unwanted voltage drops.

The SET power of the first wordline W1 is:

$P_{W\; 1} = {{\frac{N}{2}P_{SET}} + {\frac{N}{2}\frac{\left( {V_{SET} - V_{SBL}} \right)^{2}}{R_{H}}} + {\left( {M - 1} \right){\frac{N}{2}\left\lbrack {\frac{V_{SWL}^{2}}{R_{H}} + \frac{\left( {V_{SWL} - V_{SBL}} \right)^{2}}{R_{H}}} \right\rbrack}}}$

In the SET of the second worldine W2, the consumed power is:

$P_{W\; 2} = {{\frac{N}{2}P_{SET}} + {\frac{N}{2}\frac{\left( {V_{SET} - V_{SBL}} \right)^{2}}{R_{H}}} + {\left( {M - 2} \right){\frac{N}{2}\left\lbrack {\frac{V_{SWL}^{2}}{R_{H}} + \frac{\left( {V_{SWL} - V_{SBL}} \right)^{2}}{R_{H}}} \right\rbrack}} + {{\frac{N}{2}\left\lbrack {V_{SWL}^{2} + \left( {V_{SWL} - V_{SBL}} \right)^{2}} \right\rbrack}\left( {\frac{1}{2\; R_{L}} + \frac{1}{2R_{H}}} \right)}}$

The power at the third wordline W3 is:

$P_{W\; 3} = {{\frac{N}{2}P_{SET}} + {\frac{N}{2}\frac{\left( {V_{SET} - V_{SBL}} \right)^{2}}{R_{H}}} + {\left( {M - 3} \right){\frac{N}{2}\left\lbrack {\frac{V_{SWL}^{2}}{R_{H}} + \frac{\left( {V_{SWL} - V_{SBL}} \right)^{2}}{R_{H}}} \right\rbrack}} + {2{\frac{N}{2}\left\lbrack {V_{SWL}^{2} + \left( {V_{SWL} - V_{SBL}} \right)^{2}} \right\rbrack}\left( {\frac{1}{2\; R_{L}} + \frac{1}{2R_{H}}} \right)}}$

At the last wordline (there are a total of M wordlines per block):

$P_{WM} = {{\frac{N}{2}P_{SET}} + {\frac{N}{2}\frac{\left( {V_{SET} - V_{SBL}} \right)^{2}}{R_{H}}} + {{\left( {M - 1} \right) \cdot {\frac{N}{2}\left\lbrack {V_{SWL}^{2} + \left( {V_{SWL} - V_{SBL}} \right)^{2}} \right\rbrack}}\left( {\frac{1}{2\; R_{L}} + \frac{1}{2R_{H}}} \right)}}$

The power expressions for a SET process for wordline's index i out of M, when previous (i−1) wordlines have already been written:

$P_{Wi} = {{\frac{N}{2}P_{SET}} + {\frac{N}{2}\frac{\left( {V_{SET} - V_{SBL}} \right)^{2}}{R_{H}}} + {\left( {M - i} \right){\frac{N}{2}\left\lbrack {\frac{V_{SWL}^{2}}{R_{H}} + \frac{\left( {V_{SWL} - V_{SBL}} \right)^{2}}{R_{H}}} \right\rbrack}} + {\left( {i - 1} \right){\frac{N}{2}\left\lbrack {V_{SWL}^{2} + \left( {V_{SWL} - V_{SBL}} \right)^{2}} \right\rbrack}\left( {\frac{1}{2\; R_{L}} + \frac{1}{2R_{H}}} \right)}}$

Summing the accumulated power of row-by-row SET after the block had been erased is:

$P_{{ERS} - {SET}} = {{\sum_{i = 1}^{M}P_{Wi}} = {{{\frac{MN}{2}\left\lbrack {P_{SET} + \frac{\left( {V_{SET} - V_{SBL}} \right)^{2}}{R_{H}}} \right\rbrack} + {{\frac{N}{2}\left\lbrack {\frac{V_{SWL}^{2}}{R_{H}} + \frac{\left( {V_{SWL} - V_{SBL}} \right)^{2}}{R_{H}}} \right\rbrack}{\sum_{i = 1}^{M}\left( {M - i} \right)}} + {{\frac{N}{2}\left\lbrack {V_{SWL}^{2} + \left( {V_{SWL} - V_{SBL}} \right)^{2}} \right\rbrack}\left( {\frac{1}{2\; R_{L}} + \frac{1}{2R_{H}}} \right){\sum_{i = 1}^{M}\left( {I - 1} \right)}}} = {{{\frac{MN}{2}\left\lbrack {P_{SET} + \frac{\left( {V_{SET} - V_{SBL}} \right)^{2}}{R_{H}}} \right\rbrack} + {\frac{M\left( {M - 1} \right)}{2}{\frac{N}{2}\left\lbrack {\frac{V_{SWL}^{2}}{R_{H}} + \frac{\left( {V_{SWL} - V_{SBL}} \right)^{2}}{R_{H}}} \right\rbrack}} + {\frac{M\left( {M - 1} \right)}{2}{\frac{N}{2}\left\lbrack {V_{SWL}^{2} + \left( {V_{SWL} - V_{SBL}} \right)^{2}} \right\rbrack}\left( {\frac{1}{2\; R_{L}} + \frac{1}{2R_{H}}} \right)}} = {{\frac{MN}{2}\left\lbrack {P_{SET} + \frac{\left( {V_{SET} - V_{SBL}} \right)^{2}}{R_{H}}} \right\rbrack} + {\frac{M\left( {M - 1} \right)}{2}{\frac{N}{2}\left\lbrack {V_{SWL}^{2} + \left( {V_{SWL} - V_{SBL}} \right)^{2}} \right\rbrack}\left( {\frac{1}{2\; R_{L}} + \frac{3}{2R_{H}}} \right)}}}}}$

The overall power of consolidated copy-back and write (CBWR), given a block with i invalid pages is:

P _(CBWR) =P _(Prior-RD) +P _(Block-ERS) +P _(ERS-SET)

The normalized power per wordline when writing for i wordlines IS:

$P_{{CBWR} - {WL}} = {\frac{1}{i}P_{CBWR}}$

A consolidation of copy-back and write operations according to an embodiment is depicted in FIGS. 2A-C. In FIG. 2A, a target PRAM block 101 with 3 invalid data pages is selected for consolidation. Valid data pages 1 and 2 are read out and are placed in wordlines 1 and 3. Incoming write requests 1, 2, 3 are received by the PRAM controller 103 from host 104 and new/incoming data are placed by the consolidation management 1032 in the write buffer 1031 of the PRAM controller 103. In FIG. 28, a bitline-wise block erase is performed on the target block 1011, by sequentially powering on each bitline with V_(RST) where all other bitlines/wordlines are grounded. In FIG. 2C, valid data pages 1, 2 and incoming data 1, 2, 3 are copied-back to the target block 1011 by a row-by-row SET, such that the erased block is written with incoming data 1, 2, 3 and previous data pages 1, 2. A summary of results of the power dissipation models according to embodiments, with consolidated copy-back and write, sub block SET&RESET with prior read, and single-wordline write with prior read is shown in Table 1, FIG. 3.

Threshold-Based Consolidation Algorithm

According to an embodiment, to determine the number of invalid pages, denoted by i, in which consolidation is more power-efficient than a sub-block write, the expressions are compared and the resulting equation is solved:

P _(CBWR-WL)(i)=P _(RD-SUB-R&S)(i)

Since these equations are quadratic, there are two possible solutions, and the smaller one is taken into account since the other is out of range. The solution is illustrated in Table 3, FIG. 6. The threshold is used to determine whether to perform consolidation of copy-back and write or perform a sub-block write algorithm. Detailed steps are given in Algorithm 1.

Algorithm 1: Consolidation of Copy-Back and Write______

Input: threshold t as calculated in Table 2

(1) choose the block with most invalid pages

(2) if # number of invalid pages >t

(2.1) read valid pages

(2.2) bitline-wise block erase

(2.3) write back valid pages and incoming write requests

(3) Else

(3.1) perform sub-block write algorithm

(4) End If

Energy Savings and Implementation Overhead

According to an embodiment, the exact power of the expressions in Table 1 are calculated and normalized according to a random wordline write with prior read. FIG. 4 is a graph of the power consumption results as a function of the number of invalid pages in a PRAM block (i) for a single wordline RBS/SBR with read 301, a sub-block RESET/SET with READ 302, and a consolidated clock ERASE/SET with copy-back and write 303. The power is normalized to a single random-wordline write, and the initial block is assumed to occupy uniformly random data. The device and array parameters that are considered in the power estimation are shown in Table 2, FIG. 5. In addition, evaluation software that calculates the graph with proper crossing points with different device variables and block sizes is attached in the appendix.

According to an Embodiment, Up to a 40% Power Reduction is Observed as Compared to only a sub-block write algorithm and up to 60% as compared to a current random wordline write. The gain increases exponentially above a threshold. The exact gain is determined according to workload characteristics and the distribution of invalid pages in blocks.

According to an embodiment, implementation of a consolidated copy-back with write involved modifying the controller as follows.

Write Data Buffer:

The controller should be able to accumulate incoming write requests data and valid pages data of target block. However, this buffer is also used by sub-block write algorithms and therefore smaller changes are made over previous algorithm overhead.

Controller Logic and Software:

According to an embodiment, the consolidation process should be managed by the controller and includes meta-data management of invalid pages in a block, which already exists in current write mechanisms, a scheduler for reading valid pages, write buffer management and allocating copy-back and write incoming pages to the target block. Additional overhead over a sub-block write is the threshold consideration.

According to an embodiment, PRAM array voltages for bitline-wise erases are a sub-group of regular RESET processes, and can be implemented in a conventional memory chip.

Expansion of a consolidation process according to an embodiment to multi-level cells does not require additional modifications. Furthermore, a consolidation process according to an embodiment can be combined with other write algorithms to increase data reliability, since the reduction of power drops over unselected cells also reduces write disturb. A consolidation process according to an embodiment is scalable as it achieves more gain, i.e. lower power, as a block size grows. The overhead can be shown to be practical, and can be reduced further if an algorithm according to an embodiment id implemented on top of a previous sub-block write scheme.

Wear Leveling and Bad Row Management

During a wear leveling process according to an embodiment, line data is copied and re-written to another line. The re-write process to the new line can detect a bad row and activate a bad-row management within a wear leveling process.

Wear Leveling

A wear-leveling (WL) algorithm according to an embodiment of the disclosure works by constantly changing the logical-to virtual (L2V) address mapping, and re-mapping the memory lines according to the new mapping. The act of changing the entire mapping one time can be referred to as a “round”, and the act of re-mapping one memory-line according to the new mapping can be referred to as a “step”. When all memory-lines are re-mapped according to the new mapping, i.e., one per step, one round is complete, the mapping changes, and a new round begins.

A mapping function according to an embodiment includes two components: a first, fixed component, and a second, which is composed on the first, changing component. As illustrated in FIG. 7, the fixed part is a multiplication of the logical address (LA), viewed as a binary vector, by a fixed binary invertible matrix, and the changing part is an addition, modulo the number of lines, of a fixed offset to the result of the previous step, viewed this time as a natural number represented in binary. In each round, this offset is increased by one modulo the number of physical lines. The result is a binary vector of virtual addresses (VA).

According to an embodiment, a bad row management (BRM) algorithm acts on top of a WL-algorithm. A BRM algorithm “filters out” the bad blocks, by mapping the virtual addresses to physical addresses that are not bad.

To enable a WL-algorithm according to an embodiment, a spare physical line is used, so there is always a free line into which to move the currently-updated line; when this currently-updated line is transferred, its previous location is the target for the next re-mapped line, and so on. However, according to an embodiment, a WL-algorithm and a BRM-algorithm work in combination: since the BRM requires over-provisioning, at any given time there is a sequence of spare lines; in each step the WL algorithm uses the last line from this sequence as the target for the newly transferred line; its previous location enters the sequence; and so on. Thus, the spare sequence moves along the physical space, and within each round the lines are updated in a descending order, as illustrated in FIG. 8.

During the life of a PRAM, the size of the spare sequence is decreased, as new lines are declared “bad”. The failure mechanism is that due to temperature changes, the physical contact between chip circuitry and line contact becomes disconnected, so that the line itself becomes inoperative.

According to an embodiment, a step is performed according to a system timing policy.

Some possible policies are:

-   -   Execute one step every predetermined (parameterized) number of         write operations.     -   Execute multiple steps when the system is idle.     -   A hybrid of the previous two: maintain a balance between the         number of write operations and the executed steps by using idle         periods to execute steps when such periods exist, but when there         are no idle periods and the system deviates somewhat from         balance, initiate step executions until the balance is reached         again.

According to an embodiment, an L2V mapping can be defined as follows:

At round r, executing step s comprises mapping address {right arrow over (x)}∈{0,1}^(n):

f({right arrow over (x)})={right arrow over (x)}·P·{right arrow over (b)}+r+c·(mod 2^(n) +z),

where:

n is the log (base 2) of the logical address space size;

P is the permutation (invertible) n×n matrix;

{right arrow over (b)}=(2^(n-1),2^(n-2), . . . , 1)^(T), used here to convert the binary vector to the natural number it represents;

z is the current number of spare lines; and

$c = \left\{ {\begin{matrix} {1,} & {{\overset{->}{x} \cdot P \cdot \overset{->}{b}} \geq {n - s}} \\ {0,} & {else} \end{matrix},} \right.$

that is, c equals 0 if physical address {right arrow over (x)}·P·{right arrow over (b)} is not updated in the current round, and 1 otherwise.

Note that the multiplication by {right arrow over (b)} is written here for formal reasons, it does not correspond to any operation in hardware. In hardware, the result of {right arrow over (x)}·P is simply added to r+c·z.

Bad Row Management

According to an embodiment, the output of the L2V module is provided as input to a BRM algorithm, which filters out lines that are declared as bad by mapping the virtual addresses to the set of lines that are not declared bad. This means, in particular, that the size of the virtual space is exactly the number of non-bad lines.

Lines can be declared as bad either at manufacture time, or during the life of the PRAM, however, embodiments of the disclosure can handle both cases similarly.

A virtual-to-physical (V2P) address mapping is straightforward: virtual address v is mapped to the v-th non-bad line. The implementation is as follows: Let the sorted list of physical addresses of bad lines be (b₁ . . . b_(t)), where l is the current number of bad lines.

A BRM algorithm according to an embodiment maintains a list S=(s₁, . . . , s_(l)) derived from the set of bad lines as follows: the value of s_(i) is the largest virtual address mapped to a physical address below b_(i). Formally: s_(i)=b_(i)−i. In addition, define s₀=−1 for convenience.

Then, the virtual address v is mapped to v+i where i is the index of a maximum value s such that s_(i)<v. The value I can be found through a binary search.

The table of FIG. 9 illustrates an example of a V2P mapping, where virtual addresses that are X's denote bad lines.

According to an embodiment, the list S can be maintained as follows.

Initialization:

1. s₀←−1

2. For i=1 to l

-   -   2.1. s_(i)←∞

Insertion:

Input: new bad physical line b

1. Find via binary search the maximal j such that s_(j)+j<b

-   -   //Insert b−(j+1) to s_(j+1):

2. For i=l to j+2

-   -   2.1. s_(i)←s_(i-1)

3. s_(j+1)←b−(j+1)

According to an embodiment, since a BRM algorithm is based on binary search, the number of supported bad blocks is limited by the number of steps that the binary search can support. To support a larger number of bad lines, an alternative approach according to an embodiment would be to declare as “bad” units that are larger than lines. If these units have 2^(q) lines, then q steps are saved in the binary search. These units are managed similarly as before, but over a space of size divided by 2^(q), and declaring a unit as bad when the first line in the unit turns bad. Denoting the previous mapping by f, the mapping then is performed as following:

Input: virtual address v

Output: physical address p

Parameter: BRM granularity q

1. q←[v/2^(r)]

2. r←v−q

3. p←f(q)+r

System Implementations

It is to be understood that embodiments of the present disclosure can be implemented in various forms of hardware, software, firmware, special purpose processes, or a combination thereof. In some embodiments, the present disclosure can be implemented in hardware as an application-specific integrated circuit (ASIC), or as a field programmable gate array (FPGA). In other embodiments, the present disclosure can be implemented in software as an application program tangible embodied on a computer readable program storage device. The application program can be uploaded to, and executed by, a machine comprising any suitable architecture.

FIG. 10 is a block diagram of a system that implements a method for combining a write algorithm with selective valid pages read and copy-back according to an embodiment of the disclosure that consumes low power and maintains the required precision. Referring now to FIG. 10, a computer system 91 for implementing the present invention can comprise, inter alia, a central processing unit (CPU) 92, a memory 93 and an input/output (I/O) interface 94. The computer system 91 is generally coupled through the I/O interface 94 to a display 95 and various input devices 96 such as a mouse and a keyboard. The support circuits can include circuits such as cache, power supplies, clock circuits, and a communication bus. The memory 93 can include random access memory (RAM), read only memory (ROM), disk drive, tape drive, etc., or a combinations thereof. The present disclosure can be implemented as a routine 97 that is stored in memory 93 and executed by the CPU 92 to process the signal from the signal source 98. As such, the computer system 91 is a general purpose computer system that becomes a specific purpose computer system when executing the routine 97 of the present invention. Alternatively, as described above, embodiments of the present disclosure can be implemented as an ASIC or FPGA 97 that is in signal communication with the CPU 92 to process the signal from the signal source 98.

The computer system 91 also includes an operating system and micro instruction code. The various processes and functions described herein can either be part of the micro instruction code or part of the application program (or combination thereof) which is executed via the operating system. In addition, various other peripheral devices can be connected to the computer platform such as an additional data storage device and a printing device.

It is to be further understood that, because some of the constituent system components and method steps depicted in the accompanying figures can be implemented in software, the actual connections between the systems components (or the process steps) may differ depending upon the manner in which the present invention is programmed. Given the teachings of the present invention provided herein, one of ordinary skill in the related art will be able to contemplate these and similar implementations or configurations of the present invention.

While the present invention has been described in detail with reference to exemplary embodiments, those skilled in the art will appreciate that various modifications and substitutions can be made thereto without departing from the spirit and scope of the invention as set forth in the appended claims. 

What is claimed is:
 1. A method of performing a write operation in a random access memory (RAM), comprising the steps of: selecting a target block in a RAM with a greatest number of invalid pages; reading valid pages from target block, when a number of invalid pages is greater than a predetermined threshold; performing a bitline-wise block erase of the target block in said RAM; and copying-back valid data to the erased target block in a row-by-row set operation, wherein the erased target block is written with the valid data.
 2. The method of claim 1, further comprising receiving an incoming write request, and writing data of the incoming write request to the target block in the row-by-row set operation, wherein the incoming data is written to the erased block along with the valid data.
 3. The method of claim 2, further comprising placing data of the incoming write request in a write buffer of a controller of said RAM.
 4. The method of claim 1, wherein performing the bitline-wise block erase comprises sequentially powering on each bitline with a predetermined reset voltage wherein all other bitlines and wordlines are grounded.
 5. The method of claim 1, further comprising, when the number of invalid pages is less than or equal to the predetermined threshold, performing a sub-block write operation of data received with a write request.
 6. The method of claim 1, wherein the RAM is one selected from a group comprising a phase change random-access memory, a resistive random-access memory, a ferroelectric random-access memory, and a magnetoresistive random-access memory.
 7. The method of claim 1, wherein the bitline-wise block erase is one of a partial block erase or a full block erase.
 8. The method of claim 1, wherein the steps of selecting a target block, reading valid pages from target block, performing a bitline-wise block erase of the target block, and copying-back valid data to the erased target block are performed as one of an automatic refresh operation or as an operation initiated by a user.
 9. The method of claim 1, further comprising mapping a logical address of a bitline of the target block to a virtual address according to f({right arrow over (x)})={right arrow over (x)}·P·{right arrow over (b)}+r+c·q(mod 2^(n) +z), wherein {right arrow over (x)} is an n-bit logical address, f({right arrow over (x)}) is the virtual address, n is a log (base 2) of the logical address space size, P is an invertible n×n permutation matrix, {right arrow over (b)}=(2^(n-1),2^(n-2), . . . ,1)^(T) is a vector that converts the binary n-bit address to a natural number, z is a current number of spare lines $c = \left\{ {\begin{matrix} {1,} & {{{if}\mspace{14mu} {\overset{->}{x} \cdot P \cdot \overset{->}{b}}} \geq {n - s}} \\ {0,} & {otherwise} \end{matrix},} \right.$ r is a round number, wherein a round is an act of remapping all lines in the target block, and s is a step number, wherein a step is an act of re-mapping one bitline.
 10. The method of claim 9, further comprising mapping the virtual address of the bitline of the target block to a physical address by mapping the virtual address v to v+i where i is the index of a maximum value s such that s_(i)<v, wherein s_(i)∈S=(s₁, . . . , s_(l)) wherein a value of s_(i) is a largest virtual address that maps to a physical address below b_(i) wherein b_(i)∈(b₁, . . . , b_(l)), a sorted list of physical addresses of bad lines wherein l is a current number of bad lines.
 11. A non-transitory program storage device readable by a computer, tangibly embodying a program of instructions executed by the computer to perform the method steps for a write operation in a random access memory (RAM), the method comprising the steps of: selecting a target block in a RAM with a greatest number of invalid pages; reading valid pages from target block, when a number of invalid pages is greater than a predetermined threshold; and performing a bitline-wise block erase of the target block in said RAM, wherein performing the bitline-wise block erase comprises sequentially powering on each bitline with a predetermined reset voltage wherein all other bitlines and wordlines are grounded.
 12. The computer readable program storage device of claim 11, the method further comprising receiving an incoming write request, and copying-back valid data to the erased target block in a row-by-row set operation, wherein data of the incoming write request is written to the target block in the row-by-row set operation, the incoming data is written to the erased block along with the valid data, and the erased target block is written with the valid data.
 13. The computer readable program storage device of claim 12, the method further comprising placing data of the incoming write request in a write buffer of a controller of said RAM.
 14. The computer readable program storage device of claim 11, the method further comprising, when the number of invalid pages is less than or equal to the predetermined threshold, performing a sub-block write operation of data received with a write request.
 15. The computer readable program storage device of claim 11, wherein the RAM is one selected from a group comprising a phase change random-access memory, a resistive random-access memory, a ferroelectric random-access memory, and a magnetoresistive random-access memory.
 16. The computer readable program storage device of claim 11, wherein the bitline-wise block erase is one of a partial block erase or a full block erase.
 17. The computer readable program storage device of claim 11, wherein the steps of selecting a target block, reading valid pages from target block, performing a bitline-wise block erase of the target block, and copying-back valid data to the erased target block are performed as one of an automatic refresh operation or as an operation initiated by a user.
 18. The computer readable program storage device of claim 11, the method further comprising mapping a logical address of a bitline of the target block to a virtual address according to f({right arrow over (x)})={right arrow over (x)}·P·{right arrow over (b)}+r+c·q(mod 2^(n) +z), wherein {right arrow over (x)} is an n-bit logical address, f({right arrow over (x)}) is the virtual address, n is a log (base 2) of the logical address space size, P is an invertible n×n permutation matrix, {right arrow over (b)}=(2^(n-1),2^(n-2), . . . , 1)^(T) is a vector that converts the binary n-bit address to a natural number, z is a current number of spare lines, $c = \left\{ {\begin{matrix} {1,} & {{{if}\mspace{14mu} {\overset{->}{x} \cdot P \cdot \overset{->}{b}}} \geq {n - s}} \\ {0,} & {otherwise} \end{matrix},} \right.$ r is a round number, wherein a round is an act of remapping all lines in the target block, and s is a step number, wherein a step is an act of re-mapping one bitline.
 19. The computer readable program storage device of claim 18, the method further comprising mapping the virtual address of the bitline of the target block to a physical address by mapping the virtual address v to v+i where i is the index of a maximum value s such that s_(i)<v, wherein s_(i)∈S=(s₁, . . . , s_(l)) wherein a value of s_(l) is a largest virtual address that maps to a physical address below b_(i) wherein b_(i)∈(b₁, . . . , b_(l)), a sorted list of physical addresses of bad lines wherein l is a current number of bad lines.
 20. A method of performing a write operation in a random access memory (RAM), comprising the steps of: selecting a target block in a RAM with a greatest number of invalid pages; and performing a sub-block write operation of data received with a write request, when the number of invalid pages is less than or equal to the predetermined threshold. 